﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _02_类
{
    class Program
    {
        static void Main(string[] args)
        {
            StudentClass s1 = new StudentClass("123");
            string msname=s1.GetStudentName();
            int int_i;
            int int_j = 001;
            //Console.WriteLine(int_i);
            Console.WriteLine(int_j);

            s1.GetStudentId(out int_i);
            s1.GetStudentId2(ref int_j);
            Console.WriteLine(int_i);
            Console.WriteLine(int_j);

            Console.ReadKey();
        }
    }
    //类
    class StudentClass
    {
        private string _studentName = string.Empty;
        /// <summary>
        /// 属性
        /// </summary>
        public int StudentId { get; set; }
        public string StudentName { get; set; }
        private int myVar;

        public int MyProperty
        {
            get { return myVar; }
            set { myVar = value; }
        }
        
        /// <summary>
        /// 构造函数
        /// </summary>
        public StudentClass()
        {
            _studentName="beijing";
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="name"></param>
        public StudentClass(string name)
        {
            _studentName = name;
        }
        static StudentClass() 
        {
            Console.WriteLine("静态构造函数被调用了！");
        
        }
        /// <summary>
        /// 方法：[访问修饰符] [返回值类型] [函数名] ([参数],[参数2]...) 
        /// </summary>
        /// <returns></returns>
        public string GetStudentName()
        {
            return _studentName;
        }
        public void GetStudentId(out int id)
        {
            id = 12;
        }
        public void GetStudentId2(ref int id)
        {
            id = 13;
        }
    }
}
